Skip to content

fix(app-shell): a permission set outside a delegated security admin's scope offers no Add and no Remove - #35389

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34741-delegated-scope-controls
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34741-delegated-scope-controls

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #34741

Clause-②: no
Metadata-protocol: none

Seat repo:objectstack#5 · os-bill · area ux-1 · session_01Utp6CbSphdunq2aJq7ktuY · claim 7001679657

维护者速读

  • 用户看到的变化:委派安全管理员打开一个不在自己委派范围内的权限集时,只看到持有人名单,不再出现添加、选人和移除按钮。
  • 为什么:这些操作服务端本来就会拒绝,先让人点再报错是误导;页面只读取服务端自己报告的委派范围,不在前端另抄规则。
  • 如果判断错:只影响按钮显隐,服务端判定不变;同时兼任组织管理员和委派管理员的少数人,在本页会看不到本可操作的按钮。
  • 需要您做的:无。

What changes

AssignedUsersSection (the Assigned users section of a permission set, and the member picker its Add opens) now reads the caller's own delegable-scope report — my-delegable-scope, through useAuth().describeDelegableScope, the read InviteMemberDialog makes — and reflects it (ADR-0090 D6/D12: the server gate decides, the client only reflects the server's own report):

  • Hidden: where the report names delegated scopes and the set's name is in none of their assignablePermissionSets, the section offers no Add, mounts no picker, draws no Remove on a direct-grant row or an unresolved-grant row, and drops the "click Add" sentence from the empty state. The holders are still listed.
  • Unchanged (today's controls, as the affordance gate draws them): a tenant-level administrator (isTenantAdmin); a report with no delegated scope, which is how the report draws an organization administrator; and no report at all — while it is read, where no runtime serves it, or where the read fails (fail-open UI, the server decides).
  • The report is read again when the active organization changes (the server resolves it in that organization), and a report read for another organization is never answered. The reader is held in a ref, never keyed on its identity (ui AGENTS.md chore: version packages #10).

outsideDelegatedScope is the whole client-side judgement: membership of the set's name in the report's allowlists. No business-unit subtree, package-holder or containment logic is copied into the client.

What the UI pre-empts, and what it does not. Pre-empted: an Add or Remove of a set outside every allowlist the caller's scopes carry — the refusal the gate gives as DELEGATION_SCOPE_VIOLATION ("permission set ... is not in the scope's allowlist"). Not pre-empted, still refused by the server in its own words: a target user outside the delegate's business-unit subtree (per user, not per set); a scope that lists the set but lacks manageAssignments; an allowlist entry that names the set at another package holder (ADR-0150); the strict-containment refusal for a set that itself carries an adminScope; and a delegate with no active organization (its scopes resolve to none on the report, so the controls stay and the server refuses).

Tests

Pins are a new top-level describe in the shared harness AssignedUsersSection.test.tsx, which now stands @object-ui/auth's useAuth in with a settable report and active organization (default: no report, no organization — the earlier cases are unchanged):

  • delegate, set outside every scope: no Add, no Remove on the direct grant, holders still listed;
  • delegate, set nobody holds: the empty state does not say to click Add;
  • delegate, an unresolved grant under two package holders: no Remove on it;
  • organization switch: a report read in another organization narrows nothing while the new one is in flight, and the new one applies once it lands;
  • controls kept: a delegate one of whose scopes allowlists the set; a tenant-level administrator; an organization administrator (no delegated scope); no report; a failed report read.
Targeted tests on a336d05 — 12 files, 146 tests pass
cd ui && pnpm exec vitest run --maxWorkers=2 \
  packages/app-shell/src/views/metadata-admin/AssignedUsersSection \
  packages/app-shell/src/views/metadata-admin/setupHoldersGrant-12082 \
  packages/plugin-form/src/affordanceGrantMap-12082 \
  packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.holderSections-32537
 Test Files  12 passed (12)
      Tests  146 passed (146)
os-verify-lock: VERDICT command-exit 0

Every file that reads this component ran (the nine AssignedUsersSection files, the setup holders grant pin, the affordance-to-grant census, the permission-set editor's holder sections). The census keys the two write sites as AssignedUsersSection > addUsers :: create and AssignedUsersSection > removeUser :: delete; both names are unchanged. The full app-shell suite is left to CI's Test UI.

Type check — app-shell, both projects
pnpm --filter @object-ui/app-shell type-check   (tsc --noEmit && tsc -p tsconfig.test.json)
os-verify-lock: VERDICT command-exit 0
Ablations (one-shot, through scripts/ablation-replace.mjs, each restored to the HEAD blob with an empty git diff HEAD)

The tests import the component from source (relative import), so no build sits between a mutation and the run.

1. outsideDelegatedScope's allowlist test replaced by `return false;`
   x a delegate whose scopes allowlist the set elsewhere: no Add and no Remove on the direct grant
   x a delegate, a set nobody holds: the empty state does not say to click Add
   x a delegate: an unresolved grant of the set offers no Remove either
   x a report read in another organization narrows nothing once the active organization changes
   Tests  4 failed | 24 passed (28)
2. the tenant-admin / no-scope carve-out reduced to `if (!report) return false;`
   x CONTROL: a tenant-level administrator keeps Add and Remove
   x CONTROL: an organization administrator (no delegated scope on the report) keeps Add and Remove
   Tests  2 failed | 26 passed (28)
3. the organization keying dropped (`return read !== null ? read.report : null;`)
   x a report read in another organization narrows nothing once the active organization changes
   Tests  1 failed | 27 passed (28)

Acceptance notes

  • The report cannot tell an organization administrator who also holds a delegated scope from a delegate. Such a caller is read as the delegate its scopes describe, so on a set outside its allowlists but inside the organization boundary it loses Add / Remove here although the gate's organization-administrator branch would admit the write. An organization administrator holding no delegated scope (the shipped organization_admin sets carry none) keeps the controls. Closing the gap needs the report to say it — e.g. an organization-administrator flag or a top-level list of the sets the caller may grant — which is a contract change in packages/spec and outside this card's fence; it is raised with the seat rather than worked around in the client.
  • Controls are drawn while the report is in flight and withdrawn when it lands, as InviteMemberDialog behaves; nothing is written in between without the server deciding.
  • The position-holders section (PositionHoldersSection) has the same shape — Add / Remove offered on positions the report's assignablePositions leaves out — and is not changed here (outside this card's file surface).
  • ui AGENTS.md ✨ Set up Copilot instructions #2 (package README / content/docs/frontend/ page) is not touched: outside this card's file surface; no prop, export of the package or locale key changed.

Verification

Derived gate families on a336d05 — 38 derived, 38 run, all exit 0
EXIT=0 :: node scripts/check-adr-0087-registration.mjs --base origin/main
EXIT=0 :: node scripts/check-adr-0087-registration.mjs --self-test
EXIT=0 :: node scripts/check-changeset-no-major.mjs --base origin/main
EXIT=0 :: node scripts/check-closing-keyword-parity.mjs
EXIT=0 :: node scripts/check-closing-keyword-parity.mjs --self-test
EXIT=0 :: node scripts/check-comment-mask-corpus.mjs
EXIT=0 :: node scripts/check-empty-changeset.mjs --base origin/main
EXIT=0 :: node scripts/check-empty-changeset.mjs --self-test
EXIT=0 :: node scripts/check-sdui-manifest.mjs
EXIT=0 :: node scripts/check-sdui-manifest.mjs --self-test
EXIT=0 :: node scripts/ci/snapshot-next.mjs --self-test
EXIT=0 :: node scripts/pm/check-governed-queue-guard.mjs --self-test
EXIT=0 :: node scripts/pm/release-rehearsal-clone.mjs --self-test
EXIT=0 :: node scripts/release-pending-publish.mjs --self-test
EXIT=0 :: pnpm --dir ui exec vitest run scripts/
EXIT=0 :: pnpm --filter @objectstack/spec run check:duration-unit-keys
EXIT=0 :: pnpm check:adr-anchors
EXIT=0 :: pnpm check:changeset-gate-self-tests
EXIT=0 :: pnpm check:closed-ceremony-text
EXIT=0 :: pnpm check:cross-package-test-inputs
EXIT=0 :: pnpm check:dispatcher-error-vocabulary
EXIT=0 :: pnpm check:driver-memory-census
EXIT=0 :: pnpm check:engine-double-contract
EXIT=0 :: pnpm check:gitlink-declared
EXIT=0 :: pnpm check:nul-bytes
EXIT=0 :: pnpm check:published-files
EXIT=0 :: pnpm check:query-options-erasure
EXIT=0 :: pnpm check:refd-timer-probe
EXIT=0 :: pnpm check:registry-log-declared
EXIT=0 :: pnpm check:rest-log-spy-declared
EXIT=0 :: pnpm check:skill-identifier-liveness
EXIT=0 :: pnpm check:test-source-alias
EXIT=0 :: pnpm check:tier-file-adoption
EXIT=0 :: pnpm check:type-check-coverage
EXIT=0 :: pnpm check:type-check-debt
EXIT=0 :: pnpm check:undeclared-dep-imports
EXIT=0 :: pnpm check:watch-hint-literal
EXIT=0 :: pnpm check:where-matcher
dispatch-gates --ran: 38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero)
Other local checks
eslint (the two changed files): 0 errors (warnings are the file's existing any / fast-refresh kinds)
ui check:new-line-citations: 0 new citation(s) -> exit 0
overlap-check: merges cleanly with origin/main, VERDICT clean exit 0
control-byte self-scan of the three changed files: no hits

Dogfood battery: n/a (no ! in the title, no narrowing arm).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY

Final head for L1: a336d05999a4726424eed962da715fd01c1f594e · 2026-11-19T08:07Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:分级管理员打开不归自己管的权限集时,“已分配用户”区只列出持有人,不再显示添加和移除按钮。
  • 为什么做:以前按钮照样出现,点了才被服务器拒绝,让人误以为自己有这个权限。
  • 出错会怎样:只影响按钮显不显示,能不能写入仍由服务器决定;最坏情况是按钮又出现、点了被拒,和修之前一样。
  • 要你做什么:不需要你做任何事,区域审完自己落地。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head a336d05999a4726424eed962da715fd01c1f594e · 2026-11-19T08:09Z

  • 形态 — 3 files, +240/−6:

    • app-shell/src/views/metadata-admin/AssignedUsersSection.tsx
    • its test
    • one changeset

    Base 8b550f81, K=4. check-governed-merges.mjs --pr 35389: not governed, under the 3000-line limit. Clause-②: no, Metadata-protocol: none. outsideDelegatedScope is exported from the view module but not from the package entry.

  • Fixes vs card console: hide the add / remove controls for permission sets outside a delegated security admin's scope (split from #34700) #34741

    • useDelegableScope reads useAuth().describeDelegableScope, the same report the invite dialog reads.
      • The reader is held in a ref, re-read on an organization change, and keyed by organization, so a report from another organization is never answered.
      • In flight, unserved or failed → null.
    • outsideDelegatedScope(report, set) is true only when all of these hold:
      • there is a report;
      • it is not isTenantAdmin;
      • it names at least one scope;
      • no scope's assignablePermissionSets includes the set.
    • canAdd / canRemove are ANDed with !outsideScope, which removes four things: the Add button, the picker, each row's Remove (including an unresolved grant's), and the click-Add sentence (canAdd ? … emptyAddHint : c.empty).
    • Matches the server. delegated-admin-gate.ts scopeAllows requires assignablePermissionSets.includes(set.name) as a necessary condition, so every case the UI hides is one the gate refuses (DELEGATION_SCOPE_VIOLATION). The UI judges nothing narrower (BU subtree, holder, manageAssignments), so it never hides a write the server would allow. Those narrower refusals stay the server's, in its own words.
    • The seat's answer A ("keep as shipped") on the dev's open question stands. An org admin who also holds a delegated scope is read as that delegate, because the report cannot tell them apart. The changeset states this.
  • Changeset — @object-ui/app-shell patch. Read sentence by sentence against the diff; these all match:

    • the 403 cause;
    • the report and its reader;
    • the four removed controls;
    • "the server's gate still decides";
    • the keep-controls list (tenant admin, no delegated scope, in flight, unserved, failed);
    • the org-admin-with-scope note.
  • Pins — new describe in AssignedUsersSection.test.tsx:

    • a delegate allowlisted elsewhere gets no Add or Remove;
    • a set nobody holds gets no click-Add sentence;
    • an unresolved grant gets no Remove;
    • after an organization change, the other organization's report narrows nothing;
    • CONTROLs keep Add and Remove for: an allowlisted delegate, a tenant admin, an org admin (no scope), no report, and a failed read.
  • 门禁 — 56 check-runs on this head: 41 success, 15 skipped, 0 failure.

  • 接受的偏差 — none.

  • 范围外去向 — none found.

  • 落地条款 — not governed: ux-1 lands this head after this ACCEPT. A new push needs a fresh L1 only if it changes more than a main merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY

Landing · area ux-1 · 2026-11-19T08:10Z

Reading Value
check-governed-merges --pr 35389 not governed, 246 lines → ordinary queue landing
K (merge base..origin/main, first-parent) 4 (< 15)

ACCEPT 7003480629 (L1-a) at head a336d05999a4726424eed962da715fd01c1f594e. Ready + auto-merge now. #34741 closes on merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

console: hide the add / remove controls for permission sets outside a delegated security admin's scope (split from #34700)

2 participants